<?php
/**
 * 商品管理
 * @version：1.0.0
 * @author：余工
 */

namespace App\frontend\controllers\goods;

use App\common\components\BaseController;
use Illuminate\Http\Request;

class GoodsController extends BaseController
{

//    private $dataTrueFalse = '';
//
//    public function __construct()
//    {
//        $this->dataTrueFalse = config('config.dataTrueFalse');
//    }

    /**
     * 判断真假数据
     */
//    public function test(Request $request){
//        if ($this->dataTrueFalse=='false'){
//            $list = GoodsFalseData::test();
//            return successJson('获取成功!', $list);
//        }
//        $list = Goods::test($request);
//        return successJson('获取成功!', $list);
//
//
//    }

    public function test(Request $request){
        $list = self::getData('Goods','test');
//        if ($this->dataTrueFalse=='false'){
//            $list = GoodsFalseData::test();
//            return successJson('获取成功!', $list);
//        }
//        $list = Goods::test($request);
        return successJson('获取成功!', $list);


    }

    /**
     * 商品列表
     */
    public function getGoodsList(Request $request)
    {
        $keyword = $request->keyword;

        $plugin_id = $request->plugin_id;//搜索特定插件商品

        $order_field = $request->order_field;

        $list = self::getData('Goods','getGoodsList');

        return successJson('获取成功!', $list);
    }

    /**
     * 商品详情
     */
    public function getGoodsDetails(Request $request)
    {
        $id = $request->id;

        $list = self::getData('Goods','getGoodsDetails');

        return successJson('获取成功!', $list);
    }

}
